package com.egg.servlet;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.egg.bean.GoodsAppraisesBean;
import com.egg.bean.OrdersBean;
import com.egg.bean.OrdersDetailsBean;
import com.egg.service.GoodsListService;
import com.egg.service.LGoodsAppraisesService;
import com.egg.service.LGoodsAskService;
import com.egg.service.LOrderDetailsService;
import com.egg.service.LOrdersService;
import com.egg.service.LReturnService;
import com.egg.service.LUserService;
import com.egg.service.SecondSortService;

@WebServlet("/lhome")
public class LHomeServelet extends BaseServlet{
	LOrdersService loS=new LOrdersService();
	LOrderDetailsService lodS=new LOrderDetailsService();
	LGoodsAppraisesService lgoodappS=new LGoodsAppraisesService();
	LGoodsAskService lgoodaskS=new LGoodsAskService();
	LReturnService lreS=new LReturnService();
	GoodsListService goodS=new GoodsListService();
	SecondSortService ssS=new SecondSortService();
	LUserService luser=new LUserService();
	protected String querySelect(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		List<OrdersBean> list=loS.selectNew();
		List<OrdersDetailsBean> listod=lodS.selectNew();
		double price=0;
		for(int i=0;i<listod.size();i++){
			price+=(listod.get(i).getO_price()*listod.get(i).getG_num());
		}
		int luser2=luser.selectC();
		int goodapp=lgoodappS.selectBstate();
		int goodask=lgoodaskS.selectBstate();
		int sss=ssS.selectC();
		int order=loS.selectState();
		int order2=loS.selectC();
		int retu=lreS.selectC();
		int goods2=goodS.selectC();
		int goods=goodS.selectG_state();
		request.setAttribute("order2", order2);
		request.setAttribute("sss", sss);
		request.setAttribute("luser2", luser2);
		request.setAttribute("price", price);
		request.setAttribute("goods", goods);
		request.setAttribute("goods2", goods2);
		request.setAttribute("retu", retu);
		request.setAttribute("order", order);
		request.setAttribute("goodask", goodask);
		request.setAttribute("goodapp", goodapp);
		request.setAttribute("list", list);
		return "lhomelist.jsp";
	}
}
